package com.glory.gloryquickui.adapter

import android.content.Intent
import android.view.View
import android.widget.Button
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.glory.gloryquickui.R
import com.glory.gloryquickui.activity.DemoActivity
import com.glory.gloryquickui.entity.FieldBean
import com.glory.gloryquickui.entity.TablePortraitCustomBean

/**
 *Created:YJ
 *创建时间：2021/5/18
 *Describe:
 */
class TablePortraitButtonAdapter(data: ArrayList<FieldBean>?,val tabButtonClickListener: TablePortraitButtonClickListener,val postion:Int):
    BaseQuickAdapter<FieldBean, BaseViewHolder>(
    R.layout.item_table_portrait_btn,data) {

    override fun convert(holder: BaseViewHolder, item: FieldBean) {
        holder.getView<Button>(R.id.btnMain).text = item.slot.default
        holder.getView<Button>(R.id.btnMain).setOnClickListener {
            if(tabButtonClickListener != null){
                tabButtonClickListener.tabButtonClick(postion,holder.getView(R.id.btnMain),item)
            }
        }
    }

    interface TablePortraitButtonClickListener {
        fun tabButtonClick(position: Int, view : View, field: FieldBean)
    }
}